package own.stu.jobgib.playown.fsm.hfsm.states;

import lombok.extern.slf4j.Slf4j;
import own.stu.jobgib.playown.fsm.hfsm.StateBase;
import own.stu.jobgib.playown.fsm.hfsm.StateEnum;

@Slf4j
public class StateHomeWork extends StateBase {

    private boolean isTired;

    private boolean toPlay;

    public StateHomeWork() {
        super(StateEnum.HOMEWORK);
    }

    public void onEnter() {
        log.info("开始写作业啦");
    }

    public void onExecute() {
        // 写作业累了，切换到休息状态
        if (isTired) {
            transitionEvent(StateEnum.RESET);
        }
        // 想打球了，切换到打球状态
        else if (toPlay) {
            transitionEvent(StateEnum.BASKETBALL);
        } else {
            log.info("我在写作业");
        }
    }

    public void onExit() {
        log.info("停止写作业");
        log.info("作业本收起来");
    }
}

